package com.tamtamy.jttamobile.conf;

import android.util.Log;

import com.tamtamy.jttamobile.constant.Type;
import com.tamtamy.jttamobile.exception.LoadPropertiesException;

public class JTTAProperties{

	private static final long serialVersionUID = 7478893066503503966L;

	public final static String APP_NAME = "jTTA-mobile";
	public final static String REQUEST_XML 	= ".xml";
	public final static String REQUEST_JSON = ".json";

	private String version = "0.2";
	private String type = Type.JSON;
	private boolean debug = false;
	private boolean ssl = false;

	private String apiUrl = "tamtamy.reply.it";
	private String apiUsername = null;
	private String apiPassword = null;

	public JTTAProperties() throws LoadPropertiesException {
		super(); 
		this.load();
	}
	
	private void load(){
		version = "0.1";
		type = "JSON";
		debug = Boolean.parseBoolean("true");
		apiUsername = "";
		apiPassword = "";
		apiUrl = "http://tamtamy.reply.it/tamtamy/api/";
		ssl = Boolean.parseBoolean("false");
		Log.d(this.getClass().getSimpleName(), this.toString());	
	}

	@Override
	public String toString() {
		return "JTTAProperties [version=" + version + ", type=" + type
				+ ", debug=" + debug + ", ssl=" + ssl + ", apiUrl=" + apiUrl
				+ ", apiUsername=" + apiUsername + ", apiPassword="
				+ apiPassword + "]";
	}

	public String getApiUrl() {
		return apiUrl;
	}

	public void setApiUrl(String apiUrl) {
		this.apiUrl = apiUrl;
	}

	public String getApiUsername() {
		return apiUsername;
	}

	public void setApiUsername(String apiUsername) {
		this.apiUsername = apiUsername;
	}

	public String getApiPassword() {
		return apiPassword;
	}

	public void setApiPassword(String apiPassword) {
		this.apiPassword = apiPassword;
	}

	public String getVersion() {
		return version;
	}

	public void setVersion(String version) {
		this.version = version;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public boolean isDebug() {
		return debug;
	}

	public void setDebug(boolean debug) {
		this.debug = debug;
	}

	public boolean isSsl() {
		return ssl;
	}

	public void setSsl(boolean ssl) {
		this.ssl = ssl;
	}

}
